<script>
  function delay(ms) {
    return new Promise((resolve, reject) => {
      setTimeout(resolve, ms)
    })
  }
  const p1 = delay(1000).then(() => {
    return 1
  })
  const p2 = delay(2000).then(() => {
    throw '❌'
  })
  const p3 = delay(1500).then(() => {
    throw 3
  })
  const p4 = delay(500).then(() => {
    throw 4
  })
  const p5 = new Promise(()=> {})

  const p = Promise.allSettled([p1, p2, p3, p4, p5])
  const begin = Date.now()
  p.then(
    (v) => console.log(v, Date.now() - begin),
    (e) => console.log(e.errors, Date.now() - begin)
  )
</script>
